﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace Gin
{
    public static class IOUtil
    {
        public static void CopyDirectory(string Src, string Dst)
        {
            String[] Files;

            if (Dst[Dst.Length - 1] != Path.DirectorySeparatorChar)
            {
                Dst += Path.DirectorySeparatorChar;
            }

            if (!Directory.Exists(Dst))
            {
                Directory.CreateDirectory(Dst);
            }

            Files = Directory.GetFileSystemEntries(Src);
            foreach (string Element in Files)
            {
                if (Directory.Exists(Element))
                {
                    CopyDirectory(Element, Dst + Path.GetFileName(Element));
                }
                else
                {
                    File.Copy(Element, Dst + Path.GetFileName(Element), true);
                }
            }
        }
    }
}
